package node;

public class NodeStorageConsoleApp {
	
	private static void println(Node n){
//		System.out.println(n.getData());
		if (n.getChildNodes().size() != 0) {
				for (int aa = 0; aa < n.getChildNodes().size(); aa++) {
				System.out.print(n.getChildNodes().get(aa).getData() + "-->");
				println(n.getChildNodes().get(aa));
			}
		}
	else {
		System.out.println("Empty Node!!!");
	}
}

public static void main(String[] args) throws NodeStorageException {
		
//		System.out.println("Started bulding Node structure.. ");
//		NodeBuilder builder = new NodeBuilder();
//		Node node = builder.build();
//		System.out.println("Finished sucssefully!");
//		System.out.println("---------------------");
//		
		
		try {
        	NodeStorage client = new RmiClientNodeStorage("rmi://localhost:1099/NodeStorage");
        	Node node = client.read();
        	client.store(node);
        	
        }catch (Exception e) {
            System.out.println("NodeStorageClient error:" + e.getMessage());
            e.printStackTrace();
        }
		
	//		NodeStorage nodeStorage = new JdbcNodeStorage();
	//		node = nodeStorage.read();
				
	//	NodeStorage nstor;
	//	nstor = new XmlNodeStorage();
		
	//	node = nstor.read();
	//	nstor.store(node);

	//  I want to see the result.
		
	//	println(node);
				
	}

}

